﻿using System;
using Framework.Core.Logger;
using Framework.UI.Template.CommonForm;

namespace Framework.UI.Template.Common
{
    public class FormExceptionHelper
    {
        public static void HandleException(Exception ex, bool writeLog, bool throwException)
        {
            if (writeLog)
            {
                LogHelper.WriteExceptionLog(ex.Message);
                if (ex.InnerException != null)
                    HandleException(ex.InnerException, true, false);
            }

            var exceptionForm = new ExceptionForm(ex);
            exceptionForm.ShowDialog();
        }
    }
}